import { FormFields } from '@/components'

import { reactive, ref } from 'vue'

export const showMsg = ref(false)

export const fields = reactive<FormFields[]>([
  {
    tag: 'ElInput',
    key: 'roleName',
    label: '角色名称',
    required: true,
    attrs: {}
  },
  {
    tag: 'ElInput',
    key: 'serial',
    label: '排序',
    required: true,
    attrs: {
      type: 'number',
      min: 0
    }
  },
  {
    tag: 'CESelect',
    key: 'sex',
    label: '显示',
    attrs: {
      options: [
        { value: 1, label: '显示' },
        { value: 2, label: '隐藏' }
      ]
    },
    on: {
      change: (val: any) => val
    }
  },
  {
    tag: 'ElInput',
    key: 'numberValue',
    label: '数量',
    required: true,
    show: showMsg
  },
  {
    tag: 'ElInput',
    key: 'sort',
    label: '序列号',
    required: true,
    attrs: {
      type: 'number',
      min: 0
    },
    show: showMsg
  },
  {
    tag: 'CWangeEitor',
    key: 'content',
    label: '内容',
    required: true
  }
])

export const searchFields: FormFields[] = reactive([
  {
    tag: 'ElInput',
    key: 'roleName',
    label: '角色名称',
    attrs: {}
  },
  {
    tag: 'ElInput',
    key: 'serial',
    label: '排序',
    attrs: {
      type: 'number',
      min: 0
    }
  },
  {
    tag: 'CESelect',
    key: 'sex',
    label: '性别',
    fill: true,
    attrs: {
      options: [
        { value: 1, label: '男' },
        { value: 2, label: '女' }
      ]
    },
    on: {
      change: (val: any) => val
    }
  },
  {
    tag: 'ElInput',
    key: 'numberValue',
    label: '数量'
  },
  {
    tag: 'ElInput',
    key: 'sort',
    label: '序列号',
    attrs: {
      type: 'number',
      min: 0
    }
  }
])
